|
|
|
|
|
|
|
5. You invoke the fourth rule of data normalization if you have multiple independent one-to-many relationships within the same table. You need to use this rule when you unwittingly create relationships that do not necessarily exist. For example, if you included educational degree in the Employee skills table in the examples used in this lesson, you mistakenly aligned skills with degrees that do not necessarily match. |
|
|
|
|
|
|
|
|
6. You invoke the fifth rule of data normalization if you have multiple dependent many-to-many relationships. To resolve any potential conflict under this rule, you might need to break the different components of the relationships into separate tables and link them through another table. |
|
|
|
|
|
|
|
|
Answers to Day 16 Exercises |
|
|
|
|
|
|
|
|
1. To achieve First Normal Form, you must delete repeating groups. In this exercise, this includes the fields for the multiple automobiles (VehicleType1, Make1, Model1, Color1, Odometer1, VehicleType2, Make2, Model2, Color2, Odometer2). This requires that you create two tables. The first tracks the customers (Customers), and the second tracks their vehicles (Vehicles). |
|
|
|
|
| | | |
|
|
|
|
SerialNumber (primary key) |
|
|
|
| | | | | | | | | | | | | |
|
|
|
|
|
|
Please note that by separating the VehicleTypes into a separate table, you can have any number of vehicles for a customer. Also note that SerialNumber makes a better primary key than License because the serial number of an automobile does change, whereas a license plate can change on an annual basis. |
|
|
|
|
|
|
|
|
Next, you need to reach Second Normal Form. This requires you to take the Customer and Vehicle tables and remove any redundant data. There is no redundant data in the Customers table. The Vehicles table, on the other hand, has redundant data describing the VehicleType. You should move the type information into a separate table to yield the following structure: |
|
|
|
|
|